<!-- 危化品管理-业务报表-取用超标 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="8">
            <el-form-item label="日期">
              <el-date-picker v-model="fbillcredate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="6">
          <el-form-item label="智能柜">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options2"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <template v-if="showAll">

            <el-col :span="6">
            <el-form-item label="试剂类型">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="危化品名称">
              <el-input v-model="listQuery.fuser" placeholder="请输入名称或CAS" clearable />
            </el-form-item>
          </el-col>

          </template>

          <el-col :span="6">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" >查询</el-button>
              <!-- <el-button type="primary" icon="el-icon-plus" @click="insert(undefined)">新增</el-button> -->
              <el-button type="danger" icon="el-icon-download">导出</el-button>
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>

      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FSTOCK" label="智能柜"></el-table-column>
          <el-table-column prop="FBARCODE" label="试剂条码" ></el-table-column>
          <el-table-column prop="FCATNAME" label="试剂名称" ></el-table-column>
          <el-table-column prop="FQTY" label="库存数量" width="85"></el-table-column>
          <el-table-column prop="FINDATE" label="入库日期" ></el-table-column>
          <el-table-column prop="FMRKDATE" label="过期日期" ></el-table-column>
          <el-table-column fixed="left" label="操作" align="center" width="100">
            <template slot-scope="scope">
              <el-button type="text" @click="insert(scope.row.FBILLNO)" size="small" icon="el-icon-edit">
                查看详情
              </el-button>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"/>
        <Form ref="Form"  :formationlist="customlist" />
      </div>
    </div>
  </div>
</template>
<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '奉1教楼101'
        }, {
          value: '2',
          label: '奉1教楼102'
        }, {
          value: '3',
          label: '奉综合楼201'
        }, {
          value: '4',
          label: '奉综合楼202'
        }],


        options2: [{
          value: '1',
          label: '测试RFID柜-1'
        }, {
          value: '2',
          label: '测试RFID柜-2'
        }],

        options3: [{
          value: '10',
          label: '易制毒'
        }, {
          value: '20',
          label: '易制爆'
        }, {
          value: '21',
          label: '一般化学品'
        },
       ],

        customlist:[
          {
            "FPARENTNO":"",
            "FLAYNO":"",
            "FPOINT":"",
            "FCATNO":"",
            "FCATNAME":"",
            "FSPEC":"",
            "FQTY":""
          },
        ],
        list: [
            {
            "FSTOCK":"化学系仓库",
            "FBARCODE":"2023101200019",
            "FCATNAME":"过氧化叔丁醇",
            "FCASNO":"75-91-2",
            "FQTY":"7",
            "FINDATE":"2023-10-12",
            "FMRKDATE":"2024-12-11"
            },{
            "FSTOCK":"化学系仓库",
            "FBARCODE":"2023101200021",
            "FCATNAME":"十二烷基三氯硅烷",
            "FCASNO":"4484-72-4",
            "FQTY":"3",
            "FINDATE":"2023-10-12",
            "FMRKDATE":"2024-12-11"
            },
            ,{
            "FSTOCK":"化学系仓库",
            "FBARCODE":"2023101200025",
            "FCATNAME":"硫酸肼",
            "FCASNO":"10034-93-2",
            "FQTY":"6",
            "FINDATE":"2023-10-12",
            "FMRKDATE":"2024-12-11"
            },{
            "FSTOCK":"化学系仓库",
            "FBARCODE":"2023101200028",
            "FCATNAME":"过氧化叔丁醇",
            "FCASNO":"75-91-2",
            "FQTY":"5",
            "FINDATE":"2023-10-12",
            "FMRKDATE":"2024-12-11"
            },
        ],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        total: 0,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fbillstate: "",
          fbillno: "",
          begindate: undefined,
          enddate: undefined,
          fcustomno: ""
        },
      };
    },
    computed: {},
    methods: {
      insert(id) {
        this.$refs.Form.init(id);
      },
    },
  };
</script>